package com.example.test;

import com.example.test.PlayGround.TouchUp;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class MainActivity extends Activity {

	private TextView tv;
	private  Button b;
	private PlayGround pg;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		tv=(TextView) findViewById(R.id.tv);
		b=(Button) findViewById(R.id.b);
		pg=(PlayGround) findViewById(R.id.pg);
		tv.setText("请围住红点");
		
		b.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				pg.initData();
				pg.redraw();
				tv.setText("请围住红点");
			}
		});
		pg.setTouchUp(new TouchUp() {
			
			@Override
			public void up() {
				tv.setText("总共"+pg.getStep()+"步");
				
			}
		});
	}

	
	
}
